<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        var a = new Promise((resolve,reject)=>{
            setTimeout(() => {
                resolve("http1")
            }, 2000);
        })
        var b = new Promise((resolve,reject)=>{
            setTimeout(() => {
                resolve("http2")
            }, 1000);
        })
        /* 
        1.then
        2.await 代码就会停顿，promise执行完毕之后才会执行后面的代码
         */
         async function go(){
             var res = await a;
             var reg = await b;
             console.log(res)
             console.log(reg);
         }
         go();
    </script>
</body>
</html>